import { Module } from '@nestjs/common';
import {TypeOrmModule} from '@nestjs/typeorm';
import { Goods } from "../entities/goods.entity";
import { Category } from "../entities/category.entity";
import { Ad } from "../entities/ad.entities";
import { AdPosition } from "../entities/ad_position.entities";
import { Brand } from "../entities/brand.entities";
import { Bulletin } from "../entities/bulletin.entities";
import { User } from "../entities/user.entities";
import { Topic } from '../entities/topic.entity';
import { TopicCategory } from '../entities/topic_category.entity';
import { UserLevel } from '../entities/user_level.entities';
import { UserCoupon } from '../entities/user_coupon.entities';
import { GoodsAttribute } from '../entities/goods_attribute.entity';
import { GoodsSpecification } from '../entities/goods_specification.entity';
import { Attribute } from '../entities/attribute.entity';
import { Specification } from '../entities/specification.entity';
import { GoodsIssue } from '../entities/goods_issue.entity ';
import { Comment } from '../entities/comment.entity';
import { CommentPicture } from '../entities/comment_picture.entity';
import { Coupon } from '../entities/coupon.entity';
import { CouponGoods } from '../entities/coupon_goods.entity';
import { Order } from '../entities/order.entities';
import { OrderGoods } from '../entities/order_goods.entities';
import { Cart } from '../entities/cart.entities';
import { Product } from '../entities/product.entities';
import { Footprint } from '../entities/footprint.entities';
import { Address } from '../entities/address.entities';
import { Feedback } from '../entities/feedback.entities';
import { SearchHistory } from '../entities/search_history.entities';
import { Collect } from '../entities/collect.entity';

@Module({
  providers: [],
  imports:[
    TypeOrmModule.forRoot({
      entities: [
        Goods,Ad,AdPosition,Brand,Bulletin,
        Category,User,Topic,TopicCategory,UserLevel,
        UserCoupon,GoodsAttribute,GoodsSpecification,Attribute,Specification,
        GoodsIssue,Comment,CommentPicture,Coupon,CouponGoods,
        Order,OrderGoods,Cart,Product,Footprint,
        Address,Feedback,SearchHistory,Collect
      ],
      type: "mysql",
      host: "localhost",
      port: 3306,
      username: "nide_shop",
      password: "1741750591",
      database: "nide_shop",
      synchronize: false,
      logging: true,
      logger: "file",
      entityPrefix: "nideshop_",
    }),
    TypeOrmModule.forFeature([
      Goods, Category, Ad, AdPosition, Brand,
      Bulletin,User,Topic,TopicCategory,UserLevel,
      UserCoupon,GoodsAttribute,GoodsSpecification,Attribute,Specification,
      GoodsIssue,Comment,CommentPicture,Coupon,CouponGoods,
      Order,OrderGoods,Cart,Product,Footprint,
      Address,Feedback,SearchHistory,Collect
    ])
  ],
  exports: [TypeOrmModule]
})
export class DatabaseModule {}
